#!/bin/bash
#gameMaster ver 1.0

LOCKFILE=/tmp/gameMaster.lock
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then
    echo "gameMaster jest juz uruchomiony";
    exit
fi

trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}

#wykonywanie dzialan
while [ 1 ]; do
    echo -e ""
    php -d "memory_limit=128M" /var/www/game/symfony master:run
    echo -e ""
    php -d "memory_limit=128M" /var/www/game/symfony master:run
    sleep 7s
done

#jesli cos nie dziala manualnie usunac plik LOCKFILE
#rm -f ${LOCKFILE}
